<!DOCTYPE html>
<html>

<head>
    <title>Options for Web Search Navigator</title>
    <link rel="stylesheet" href="options_page.css">
</head>

<body>
    <section id="general-settings-container">
        <h2>General settings</h2>
        <div class="option">
            <label for="wrap-navigation">
                <input type="checkbox" id="wrap-navigation"> Wrap around when navigating before/after the first/last search result
            </label>
        </div>
        <div class="option">
            <label for="auto-select-first">
                <input type="checkbox" id="auto-select-first"> Focus on first search result automatically after the page loads
            </label>
        </div>
    </section>
    <section id="google-settings-container">
        <h2>Google specific settings</h2>
        <div class="option">
            <label for="google-include-cards">
                <input type="checkbox" id="google-include-cards"> Include cards (top stories, twitter, videos) in regular Google search page
            </label>
        </div>
        <div class="option">
            <label for="google-include-places">
                <input type="checkbox" id="google-include-places"> Include Places in regular Google search page
            </label>
        </div>
        <div class="option">
            <label for="google-include-memex">
                <input type="checkbox" id="google-include-memex"> Include WorldBrain's Memex extension results in Google search page
            </label>
        </div>
    </section>
    <section id="keybindings-container">
        <h2>Keybindings</h2>
        <details>
            <summary><h3>Help</h3></summary>
            <div class="help">
                All keybindings should be specified in
                <a href="https://github.com/ccampbell/mousetrap" target="_blank">Mousetrap</a> format. Examples:
                <ul>
                    <li>
                        <kbd class="keybinding">a</kbd>
                    </li>
                    <li>
                        <kbd class="keybinding">z y</kbd>
                    </li>
                    <li>
                        <kbd class="keybinding">ctrl+a</kbd>
                    </li>
                    <li>
                        <kbd class="keybinding">command+a</kbd>
                    </li>
                    <li>
                        <kbd class="keybinding">a, ctrl+b, z y, command+c</kbd> - multiple shortcuts that will be treated equivalently</li>
                </ul>
                Special keys names: backspace, tab, clear, enter, return, esc, escape, space, up, down, left, right, home, end, pageup, pagedown,
                del, delete, and f1 through f19. In order to disable a keybinding, delete its keybinding in the textbox.

                Note that not all search engines support all the keybindings.
            </div>
        </details>
        <details>
            <summary><h3>Common actions</h3></summary>
            <div class="option">
                <label for="next-key" class="option-desc">Next search result</label>
                <input id="next-key" class="input-keybinding" type="text" value="down, j">
            </div>
            <div class="option">
                <label for="previous-key" class="option-desc">Previous search result</label>
                <input id="previous-key" class="input-keybinding" type="text" value="up, k">
            </div>
            <div class="option">
                <label for="navigate-key" class="option-desc">Open</label>
                <input id="navigate-key" class="input-keybinding" type="text" value="return, space">
            </div>
            <div class="option">
                <label for="navigate-new-tab-background-key" class="option-desc">Open in a new background tab</label>
                <input id="navigate-new-tab-background-key" class="input-keybinding" type="text" value="ctrl+shift+return, command+shift+return, ctrl+shift+space">
            </div>
            <div class="option">
                <label for="navigate-new-tab-key" class="option-desc">Open in a new window/tab</label>
                <input id="navigate-new-tab-key" class="input-keybinding" type="text" value="ctrl+return, command+return, ctrl+space">
            </div>
            <div class="option">
                <label for="focus-search-input" class="option-desc">Focus search box</label>
                <input id="focus-search-input" class="input-keybinding" type="text" value="/, escape">
            </div>
            <div class="option">
                <label for="navigate-next-result-page" class="option-desc">Next page</label>
                <input id="navigate-next-result-page" class="input-keybinding" type="text" value="right">
            </div>
            <div class="option">
                <label for="navigate-previous-result-page" class="option-desc">Previous page</label>
                <input id="navigate-previous-result-page" class="input-keybinding" type="text" value="left">
            </div>
            <div class="option">
              <label for="copy-url-key" class="option-desc">Copy URL of focus</label>
              <input id="copy-url-key" class="input-keybinding" type="text" value="">
            </div>
        </details>
        <details>
            <summary><h3>Results filtering</h3></summary>
            <div class="option">
                <label for="navigate-show-all" class="option-desc">Turn off filter (show all results)</label>
                <input id="navigate-show-all" class="input-keybinding" type="text" value="z z, ctrl-shift-a">
            </div>
            <div class="option">
                <label for="navigate-show-hour" class="option-desc">Filter results by past hour</label>
                <input id="navigate-show-hour" class="input-keybinding" type="text" value="z h, ctrl-shift-h">
            </div>
            <div class="option">
                <label for="navigate-show-day" class="option-desc">Filter results by past 24 hours</label>
                <input id="navigate-show-day" class="input-keybinding" type="text" value="z d, ctrl-shift-d">
            </div>
            <div class="option">
                <label for="navigate-show-week" class="option-desc">Filter results by past week</label>
                <input id="navigate-show-week" class="input-keybinding" type="text" value="z w, ctrl-shift-w">
            </div>
            <div class="option">
                <label for="navigate-show-month" class="option-desc">Filter results by past month</label>
                <input id="navigate-show-month" class="input-keybinding" type="text" value="z m, ctrl-shift-m">
            </div>
            <div class="option">
                <label for="navigate-show-year" class="option-desc">Filter results by past year</label>
                <input id="navigate-show-year" class="input-keybinding" type="text" value="z y, ctrl-shift-y">
            </div>
            <div class="option">
                <label for="toggle-sort" class="option-desc">Toggle sort by date/relevance</label>
                <input id="toggle-sort" class="input-keybinding" type="text" value="z s, ctrl-shift-s">
            </div>
            <div class="option">
                <label for="toggle-verbatim-search" class="option-desc">Toggle verbatim search</label>
                <input id="toggle-verbatim-search" class="input-keybinding" type="text" value="z v, ctrl-shift-v">
            </div>
            <div class="option">
                <label for="show-images-large" class="option-desc">Filter image results by large size</label>
                <input id="show-images-large" class="input-keybinding" type="text" value="z l">
            </div>
            <div class="option">
                <label for="show-images-medium" class="option-desc">Filter image results by medium size</label>
                <input id="show-images-medium" class="input-keybinding" type="text" value="z e">
            </div>
            <div class="option">
                <label for="show-images-icon" class="option-desc">Filter image results by icon size</label>
                <input id="show-images-icon" class="input-keybinding" type="text" value="z i">
            </div>
        </details>
        <details>
            <summary><h3>Google and Startpage</h3></summary>
            <div class="option">
                <label for="navigate-search-tab" class="option-desc">Go to All (= default search tab)</label>
                <input id="navigate-search-tab" class="input-keybinding" type="text" value="a, s">
            </div>
            <div class="option">
                <label for="navigate-images-tab" class="option-desc">Go to Images</label>
                <input id="navigate-images-tab" class="input-keybinding" type="text" value="i">
            </div>
            <div class="option">
                <label for="navigate-videos-tab" class="option-desc">Go to Videos</label>
                <input id="navigate-videos-tab" class="input-keybinding" type="text" value="v">
            </div>
            <div class="option">
                <label for="navigate-maps-tab" class="option-desc">Go to Maps</label>
                <input id="navigate-maps-tab" class="input-keybinding" type="text" value="m">
            </div>
            <div class="option">
                <label for="navigate-news-tab" class="option-desc">Go to News</label>
                <input id="navigate-news-tab" class="input-keybinding" type="text" value="n">
            </div>
            <div class="option">
                <label for="navigate-shopping-tab" class="option-desc">Go to Shopping</label>
                <input id="navigate-shopping-tab" class="input-keybinding" type="text" value="alt+n">
            </div>
            <div class="option">
                <label for="navigate-books-tab" class="option-desc">Go to Books</label>
                <input id="navigate-books-tab" class="input-keybinding" type="text" value="b">
            </div>
            <div class="option">
                <label for="navigate-flights-tab" class="option-desc">Go to Flights</label>
                <input id="navigate-flights-tab" class="input-keybinding" type="text" value="alt+l">
            </div>
            <div class="option">
                <label for="navigate-financial-tab" class="option-desc">Go to Financial</label>
                <input id="navigate-financial-tab" class="input-keybinding" type="text" value="f">
            </div>
        </details>
    </section>
    <section id="search-engines-container">
        <h2>EXPERIMENTAL: Alternative search engines</h2>
        <details class="help">
            <summary><h3>Help</h3></summary>
            There is experimental support for using this extension in the websites below.
            Note that some features are still buggy in certain websites.
            You can enable or disable the extension of these websites at any time by clicking on the checkboxes.
            When you enable a website, the browser will prompt you for additional permissions which are needed to be able to run this extension on that website.
        </details>
        <div class="option">
            <label for="brave-search">
                <input type="checkbox" id="brave-search"> Enable on Brave Search
            </label>
        </div>
        <div class="option">
            <label for="startpage">
                <input type="checkbox" id="startpage"> Enable on Startpage
            </label>
        </div>
        <div class="option">
            <label for="youtube">
                <input type="checkbox" id="youtube"> Enable on YouTube
            </label>
        </div>
        <div class="option">
            <label for="google-scholar">
                <input type="checkbox" id="google-scholar"> Enable on Google Scholar
            </label>
        </div>
        <div class="option">
            <label for="amazon">
                <input type="checkbox" id="amazon"> Enable on Amazon
            </label>
        </div>
        <div class="option">
            <label for="github">
                <input type="checkbox" id="github"> Enable on Github
            </label>
        </div>
        <div class="option">
            <label for="gitlab">
                <input type="checkbox" id="gitlab"> Enable on Gitlab
            </label>
        </div>
        <div class="option">
            <label for="custom-gitlab">
                <input type="checkbox" id="custom-gitlab"> Enable on custom Gitlab
            </label>
        </div>
    </section>
    <section id="appearance-container">
        <h2>Appearance</h2>
        <div class="option">
            <label for="hide-outline">
                <input type="checkbox" id="hide-outline"> Hide outline on selected search result
            </label>
        </div>
        <div class="option">
            <h3>EXPERIMENTAL: Custom CSS</h3>
            You can set custom CSS rules to change how the focused search results are highlighted. The textarea below contains the default CSS rules.
            If you want to reset the CSS to the defaults, set the textarea content to an empty string and save.
            <details>
                <summary><h3>Edit CSS rules</h3></summary>
                <textarea name="custom-css-textarea" id="custom-css-textarea"></textarea>
            </details>
        </div>
    </section>
    <section id="advanced-settings-container">
        <details>
            <summary><h2>Advanced</h2></summary>
            <div class="option">
                <div class="help">
                    This option can be used as a workaround for some websites.
                </div>
                <div id="delay-container">
                    <label for="delay">
                        <input type="number" id="delay">Delay extension initialization in milliseconds
                    </label>
                </div>
            </div>
            <div class="option">
                <label for="simulate-middle-click">
                    <input type="checkbox" id="simulate-middle-click"> Simulate middle click when opening in a new background tab
                </label>
            </div>
            <div class="option">
                <h3>Custom Gitlab URL regex</h3>
                <div class="help">
                    Define private Gitlab URL regex. Default is ^https://(www\.)?.*git.*\. 
                </div>
                <div id="custom-gitlab-url-container">
                    <label for="custom-gitlab-url">
                        <input type="text" id="custom-gitlab-url">
                    </label>
                </div>
            </div>
        </details>
    </section>

    <div id="status"></div>
    <div id="buttons-container">
        <button id="save">Save</button>
        <button id="reset">Reset to defaults</button>
    </div>

    <script src="browser-polyfill.js"></script>
    <script src="options.js"></script>
    <script src="options_page.js"></script>
</body>

</html>
